package com.lang.service.impl;

import com.lang.dao.AddressDao;
import com.lang.dao.impl.AddressDaoImpl;
import com.lang.entity.Address;
import com.lang.service.AddressService;

import java.util.List;

/*
 * @Date : 2024/3/14 10:51
 * @Created by Lang
 * @ProjectName : LclShop
 */
public class AddressServiceImpl implements AddressService {
    private AddressDao addressDao = new AddressDaoImpl();
    @Override
    public List<Address> getAddress(int uId) {
        return addressDao.getAddress(uId);
    }

    @Override
    public int addAddress(Address address) {
        return addressDao.addAddress(address);
    }

    @Override
    public int deleteAddressByAid(String aid) {
        return addressDao.deleteAddressByAid(aid);
    }

    @Override
    public int updateAddress(Address address) {
        return addressDao.updateAddress(address);
    }

    @Override
    public void defaultAddress(String aid,int uid) {
        //设置为全部普通
        int res = addressDao.updateNoDefault(uid);
        System.out.println("设置全部普通=" + res);
        //设置全部默认
        res = addressDao.updateDefault(aid);
        System.out.println("设置默认=" + res);
    }

}
